package com.huobao.yunying.adapters;

import com.huobao.yunying.entity.ShaixuanValue;
import com.huobao.zhangying.R;

import android.content.Context;
import android.widget.CheckedTextView;
import joanzapata.android.BaseAdapterHelper;
import joanzapata.android.QuickAdapter;

public class Adapter_Shaixuan_Second extends QuickAdapter<ShaixuanValue> {

	private ShaixuanValue selectValue;

	public Adapter_Shaixuan_Second(Context context) {
		super(context, R.layout.item_shaixuan_second);

	}

	@Override
	protected void convert(BaseAdapterHelper arg0, ShaixuanValue arg1) {
		final CheckedTextView checkedTextView = arg0.getView(R.id.textview);
		checkedTextView.setText(arg1.name.equals("") ? arg1.value : arg1.name);
		checkedTextView.setChecked(arg1.isSelect);
		if (selectValue != null && selectValue.isSelect && selectValue.value.equals(arg1.value)) {
			checkedTextView.setChecked(true);
		}
	}

	public void setSelect(ShaixuanValue selectValue) {
		this.selectValue = selectValue;
		notifyDataSetChanged();
	}

}
